package com.swallow.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.swallow.user.entity.Order;
import com.swallow.user.mapper.OrderMapper;
import com.swallow.user.service.OrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.ArrayList;


/**
 * @program:cloud_demo
 * @author: 马雨清
 * @Time: 2025/4/22  19:04
 * @description:
 */
@Service
public class OrderInfoServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderInfoService  {

    @Autowired
    private OrderMapper orderMapper;

    @Transactional
    @Override
    public void insertOrder() {
        System.out.println("1234");
        ArrayList<Order> orderList = new ArrayList<>();
        for (int i = 40; i < 60; i++) {
            Order order = new Order();
            order.setPrice(BigDecimal.valueOf(i));
            order.setStatus("ok");
            order.setUserId((long) i);
            orderList.add(order);

        }
        saveBatch(orderList);
    }
}
